﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Kfsz.aspx.cs" EnableEventValidation="false" Inherits="Catering.Catering_Page.Kufang.Kfsz" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../Style/head.css" />
    <link rel="stylesheet" type="text/css" href="../../Style/center.css" />
    <link href="../../Style/zhezhao.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../Scripts/jquery-1.4.1.js"></script>
    <script src="../../Style/zhezhao.js" type="text/javascript"></script>
    <script src="../../Style/xxk.js" type="text/javascript"></script>
    <script src="../../Scripts/Calendar.js" type="text/javascript"></script>
    <style type="text/css">
        .Create_Recipe
        {
            margin-top: 0;
        }
        .Create_Recipe
        {
            border: 1px solid #159aec;
            border-top: none;
            width: 998px;
        }
        .soso_lt
        {
            padding: 5px 0;
        }
        .soso_lt a
        {
            margin-left: 3px;
        }
        .div_120
        {
            padding-top: 5px;
            background-color: #e5f1ff;
        }
        .div_120 ul
        {
            width: 996px;
            clear: both;
        }
        .div_120 li
        {
            float: left;
            height: 25px;
            line-height: 25px;
            margin-left: 10px;
        }
        .div_120 span
        {
            text-align: left;
            display: -moz-inline-box;
            display: inline-block;
            width: 60px;
        }
        .btn_list
        {
            width: 99%;
            height: 34px;
            line-height: 34px;
            padding:0px;
            border: 1px solid #c2def6;
            background-color: #e5f1ff;
            margin-top: 10px;
        }
        .kfxx_add{width:578px; height:220px; border:1px solid #c2def6; margin:0px; padding:0px;}
        .kfxx_add h1{ font-size:14px; height:27px; line-height:27px; padding-left:10px; color:#1d67c0; background:url(../../Images/div_h1_bg.gif) 0 0 repeat-x;}
        .kfxx_add h1 img{ float:left; margin-right:5px; position:relative; top:5px;*top:4px;_top:4px;}
        .kfxx_add td{ padding:6px 0px;}
    </style>
    <script type="text/javascript" language="text/javascript">
        function but_Add_Row_click() {
            $("#btn_Add_Info").show();
            $("#btn_Edit_Info").hide();
            $("#div3 input[type='text']").val("");
            $("#div3 textarea").val("");
            divshow("div3", "div2");

        }
    </script>
    <script language="javascript" type="text/javascript">
        //删除库房
        function cangku_Del_info_click(date) {
            if (!confirm("确认删除?"))
                return;

            if (date != null) {
                $.ajax({
                    type: "Post",
                    url: "../../PostDate.aspx/cangkushezhi_Del",
                    data: "{'kufangshezhi':'" + date + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        if (data.d == "OK") {
                            alert("删除成功！");
                            history.go(0);
                        }

                    }
                });
            }
        }

        //添加库房
        function but_add_info() {
            var name = $("#Txt_Raw_Name").val();
            var back = $("#Txt_beizhu").val();

            $.ajax({
                type: "Post",
                url: "Kfsz.aspx/but_add_info",
                data: "{'name':'" + name + "','back':'" + back + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "OK") {
                        alert("添加成功！");
                        window.location = 'Kfsz.aspx';
                    }
                }
            });
        }

        //修改库房
        function cangku_Edit_info_click(cid) {
            $("#HidKuID").val(cid);

            $.ajax({
                type: "Post",
                url: "Kfsz.aspx/GetFuFangInfo",
                data: "{'cid':'" + cid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    $("#Txt_Raw_Name").val(data.d[0]);
                    $("#Txt_beizhu").val(data.d[1]);
                    $("#btn_Add_Info").hide();
                    $("#btn_Edit_Info").show();
                    divshow("div2", "div3");
                }
            });
        }

        function but_Edit_info() {
            var cid = $("#HidKuID").val(cid);
            var name = $("#Txt_Raw_Name").val();
            var back = $("#Txt_beizhu").val();

            $.ajax({
                type: "Post",
                url: "Kfsz.aspx/but_Edit_info",
                data: "{'cid':'" + cid + "','name':'" + name + "','back':'" + back + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "OK") {
                        alert("修改成功！");
                        window.location = 'Kfsz.aspx';
                    }
                }
            });
        }

        $(document).ready(function () {
            $("#Drop_zuoyequ").change(function () {
                LoadBanZu(false, '-1');
            });
        });

    </script>

    <script type="text/javascript">
        $(document).ready(function () {
        });
        function Search() {
            $("#Raw_div table tr td a").css("color", "black");

            $("#Tv_RawMaterial img[alt]").each(function () {
                var str = $(this).attr("alt");
                if (str.indexOf("折叠") > -1) {
                    var ss = $(this).parents("a").attr("href");
                    window.location = ss;
                }
            });

            if ($("#Txt_seach_Raw").val() != "") {
                $("#Raw_div  a:contains('" + $("#Txt_seach_Raw").val() + "')").css("color", "red").parentsUntil("#Raw_div").filter("div").prev("table").find("a").css("color", "red");
            }
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <asp:HiddenField ID="HidKuID" runat="server" />

    <asp:ScriptManager ID="ScriptManager2" runat="server">
    </asp:ScriptManager>

    <div class="xxk_button">
        <ul>
            <li id="li2_1" class="a_hover"><a href="#" onclick="TabdivDisplay(1,2);return false;">库房信息</a></li>
            <li id="li2_2"><a href="#" onclick="TabdivDisplay(2,2);return false;">报警设置</a></li>
        </ul>
    </div>
    <div class="Center_Content" id="div2_1" style="display: block">
        <div class="div_0207" style="width:998px;">
        <table width="100%" class="ckgl_table" style="height:34px;" cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td style="width: 50%"></td>
                <td></td>
                <td align="right"><input type="button" id="but_Add_Row" value="新　增" onclick="but_Add_Row_click()" class="input_btn_a" /></td>
                <td>
                    <%-- <asp:Button ID="BT_baocun" runat="server" Text="保存" CssClass="input_btn_a" />--%>
                </td>
                <td width="10"></td>
            </tr>
        </table>
        </div>
        <div class="div_0207" style="width:998px;" align="center">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_ckdtkz">
                <thead>
                    <tr>
                        <th style="width:10%">
                            序号
                        </th>
                        <th style="width:30%">
                            库房名称
                        </th>
                        <th style="width:15%">
                            创建日期
                        </th>
                        <th style="width:30%">
                            描述
                        </th>
                        <th style="width:15%">
                            操作
                        </th>
                    </tr>
                </thead>
                <tbody id="shezhi_row">
                    <asp:Repeater ID="Repeater1" runat="server">
                        <ItemTemplate>
                            <tr style="BACKGROUND: #ffffff" onmouseover="this.style.background='#E3F5FF'" onmouseout="this.style.background='#FFFFFF'">
                                <td>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("id") %>'></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="Label5" runat="server" Text='<%# Eval("RoomID") %>'></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="Label7" runat="server" Text='<%# Eval("CreateDate") %>'></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="Label2" runat="server" Text='<%# Eval("Description") %>'></asp:Label>
                                </td>
                                <td>
                                    <img src="../../Images/file.gif" style=" cursor:pointer;" onclick='cangku_Edit_info_click(<%#Eval("id") %>)' />
                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                    <img src="../../Images/trash.gif" style=" cursor:pointer;" onclick='cangku_Del_info_click(<%#Eval("id") %>)' />
                                </td>
                            </tr>
                        </ItemTemplate>
                        <AlternatingItemTemplate>
                            <tr style="BACKGROUND: #ffffff" onmouseover="this.style.background='#E3F5FF'" onmouseout="this.style.background='#FFFFFF'">
                                <td>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("id") %>'></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="Label5" runat="server" Text='<%# Eval("RoomID") %>'></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="Label7" runat="server" Text='<%# Eval("CreateDate") %>'></asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="Label2" runat="server" Text='<%# Eval("Description") %>'></asp:Label>
                                </td>
                                <td>
                                    <img src="../../Images/file.gif" style=" cursor:pointer;" onclick='cangku_Edit_info_click(<%#Eval("id") %>)' />
                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                    <img src="../../Images/trash.gif" style=" cursor:pointer;" onclick='cangku_Del_info_click(<%#Eval("id") %>)' />
                                </td>
                            </tr>
                        </AlternatingItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
        </div>
    </div>
    <div class="Center_Content" id="div2_2" style="width: 998px; border: 1px solid #c2def6; display: none;">
        <div class="left_CR">
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <div class="Recipe_0206" id="RawMaterial" style="margin-top:10px;">
                        <table style="width:100%; background:#e5f1ff;">
                            <tr>
                                <td align="right" width="70" height="30">选择库房：</td>
                                <td><asp:DropDownList AutoPostBack="true" ID="dr_Db" runat="server" style="vertical-align:middle; height:18px; line-height:18px; width:60px;"  OnSelectedIndexChanged="dr_Db_SelectedIndexChanged" AppendDataBoundItems="True"></asp:DropDownList></td>
                            </tr>
                        </table>
                        <div id="Raw_div" class="Recipe_0206" style="height: 480px; margin-left:0px; overflow-y: scroll">
                            <asp:TreeView ID="Tv_RawMaterial" ShowLines="true" runat="server" OnSelectedNodeChanged="Tv_RawMaterial_SelectedNodeChanged"
                                ExpandDepth="3" Width="176" SelectedNodeStyle-BackColor="#FCA402">
                            </asp:TreeView>
                        </div>
                        <div class="soso_lt_div" style="width:178px;">
                        <table border="0" cellspacing="0" cellpadding="0" width="170" align="center" height="30">
                            <tr>
                                <td width="148">
                                    <input type="text" id="Txt_seach_Raw" style="width:144px; height:20px" class="input_bg" />
                                </td>
                                <td>
                                    <input type="button" class="button_soso_lt" style="margin:0px;" id="but_Raw_seach" onclick="Search()" value="" />
                                </td>
                            </tr>
                        </table>
                        </div>
                    </div>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        <div class="Right_CR">
          <asp:UpdatePanel ID="UpdatePanel2" runat="server">
            <ContentTemplate>
                <div class="btn_list" style="height:34px; width:788px;" >
                    <table width="100%" style="height:34px" border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td width="75" align="right" valign="middle">作业区：</td>
                            <td width="150"><asp:DropDownList ID="DDL_zuoyequ" runat="server" Width="140px" CssClass="select_input_bg" OnSelectedIndexChanged="DDL_zuoyequ_SelectedIndexChanged" AutoPostBack="True"></asp:DropDownList></td>
                            <td width="45" >班组：</td>
                            <td><asp:DropDownList ID="DDL_banzu" runat="server" OnSelectedIndexChanged="DDL_banzu_SelectedIndexChanged" Width="106px" CssClass="select_input_bg" AutoPostBack="True"></asp:DropDownList></td>
                        </tr>
                    </table>
                </div>
                <div style="width:500px; padding:30px; margin:30px auto auto; border:5px solid #C2DEF6; background-color:#E5F1FD;">
                    <table border="0" cellpadding="0" align="center" cellspacing="0">
                        <tr>
                            <td width="85" align="right">最大库存量：</td>
                            <td width="150">
                                <asp:TextBox ID="Txt_chaoxiankcwzyj" Width="130px" runat="server" CssClass="input_bg"></asp:TextBox><asp:Label ID="txtMaxCMP" runat="server"></asp:Label>
                            </td>
                        </tr>
                        <tr><td height="10" colspan="2"></td></tr>
                        <tr>
                            <td align="right">最低警戒线：</td>
                            <td><asp:TextBox ID="Txt_gaojikcwzyj" Width="130px" runat="server" CssClass="input_bg"></asp:TextBox></td>
                        </tr>
                        <tr><td height="10" colspan="2"></td></tr>
                        <tr>
                            <td align="center" colspan="2">
                                <asp:Button ID="but_waing_Save" Text="保存" CssClass="input_btn_a" runat="server" OnClick="but_waing_Save_Click" />
                            </td>
                        </tr>
                    </table>
                </div>
            </ContentTemplate>
    </asp:UpdatePanel>
        </div>
    </div>
    <div class="footer">
        <strong>中海油能源发展配餐服务公司渤海自营油田作业公司</strong><span>版权所有@CopyRight 2012</span></div>
    <div id="div2" class="bg">
    </div>
    <!--弹出层-->
    <div id="div3" class="center_div" style="width:580px; height:222px; padding:0px; margin-top: -120px;">
        <div class="kfxx_add">
            <h1><img src="../../Images/cp_h1_03.gif" />库房信息</h1>
            <table width="100%;">
                <tr>
                    <td width="45" align="right">名称：</td>
                    <td><asp:TextBox ID="Txt_Raw_Name" CssClass="input_bg" runat="server" Width="129px"></asp:TextBox></td>
                </tr>
                <tr>
                    <td align="right" valign="top">备注：</td>
                    <td><asp:TextBox ID="Txt_beizhu" runat="server" Width="500px" TextMode="MultiLine" Height="80"></asp:TextBox></td>
                </tr>
                            
            </table>
            <table width="100%">
                <tr>
                    <td align="right">
                        <input type="button" id="btn_Add_Info" onclick="but_add_info()"  class="input_btn_a"  value="提交" />
                        <input type="button" id="btn_Edit_Info" onclick="but_Edit_info()" class="input_btn_a" value="提交" />
                    </td>
                    <td width="10"></td>
                    <td align="left">
                        <input type="button" id="but_Close" onclick='divhidel("div2","div3")' class="input_btn_a"
                            value="关闭" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
    
    </form>
</body>
</html>
